package C;

import java.util.Arrays;
import java.util.Scanner;

public class C52 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] times = new String[n];
        for (int i = 0; i < times.length; i++) {
            times[i] = sc.nextLine();
        }
//        times[n] = "2023-01-01 00:00:01.005";
        getResult(times);
    }

    public static int getResult(String[] times) {
        int n = times.length;
        int length = times[0].length();
        Arrays.sort(times);
        System.out.println(Arrays.toString(times));
        int count = 0;
        String targetSecond = times[0].substring(0,length-4);
        System.out.println("tarSecond="+targetSecond);

        String targetMil = times[0].substring(length-3);
        System.out.println("tarMil="+targetMil);
        for (String time : times) {
            String timeSecond = time.substring(0,length-4);
            System.out.println("timeSecond="+timeSecond);
            String timeMil = time.substring(length-3);
            System.out.println("timeMil="+timeMil);
            if (timeSecond.equals(targetSecond)) {
                if (timeMil.equals(targetMil)) {
                    count++;
                } else {
                    continue;
                }
            } else {
                targetSecond = timeSecond;
                targetMil = timeMil;
                count++;
            }
            System.out.print(count+" ");
        }
        System.out.println("");
        return count;
    }
}
